package net.minecraft.src;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode

import de.matthiasmann.twl.Button;
import de.matthiasmann.twl.Widget;
import de.matthiasmann.twl.model.ButtonModel;
import de.matthiasmann.twl.model.SimpleButtonModel;
import java.io.PrintStream;
import java.lang.reflect.Field;
import java.util.*;
import net.minecraft.client.Minecraft;
import org.lwjgl.input.Keyboard;
import java.lang.reflect.Method;

public class mod_AIManager extends BaseMod
    implements Runnable {

    public String Version() {
        return "v2.23 for MC b1.3_01";
    }
    
    public void ModsLoaded() {
    	loadConfig();
    }
    
    public void loadConfig() {
    	petSettings = new ModSettings("Pet Mod Settings");
        petScreen = new ModSettingScreen("Pet Mod");
        
        //((WidgetClassicWindow)petScreen.thewidget).BackButton.getModel().addActionCallback(this);
        
        petSettings.append(nextOrderKey = new SettingKey("nextorder", "E"));
        petScreen.append(nextOrderKeyW = new WidgetKeybinding(nextOrderKey, "Next order key"));
        petSettings.append(prevOrderKey = new SettingKey("prevorder", "Q"));
        petScreen.append(prevOrderKeyW = new WidgetKeybinding(prevOrderKey, "Previous order key"));
        petSettings.append(petFollowNearKey = new SettingKey("follownear", "NUMPAD8"));
        petScreen.append(petFollowNearKeyW = new WidgetKeybinding(petFollowNearKey, "Pet follow near key"));
        petSettings.append(petFollowFarKey = new SettingKey("followfar", "NUMPAD9"));
        petScreen.append(petFollowFarKeyW = new WidgetKeybinding(petFollowFarKey, "Pet follow far key"));
        petSettings.append(forcePetStayNearKey = new SettingKey("forcePetStayNearKey", "NUMPAD5"));
        petScreen.append(forcePetStayNearKeyW = new WidgetKeybinding(forcePetStayNearKey, "Stay Near Key"));
        petSettings.append(PetFreezeKey = new SettingKey("petfreeze", "GRAVE"));
        petScreen.append(PetFreezeKeyW = new WidgetKeybinding(PetFreezeKey, "Pets no move key"));
        petSettings.append(petFollowDistNear = new SettingInt("followneardist", 5, 0, 200));
        petScreen.append(petFollowDistNearW = new WidgetInt(petFollowDistNear, "Pet follow dist. near"));
        petSettings.append(petFollowDistFar = new SettingInt("followfardist", 15, 0, 200));
        petScreen.append(petFollowDistFarW = new WidgetInt(petFollowDistFar, "Pet follow dist. far"));
        petScreen.append(blahW = new Widget());
        petScreen.append(blahW = new Widget());
        petSettings.append(petLOSCheckB = new SettingBoolean("petLOSCheckB", true));
        petScreen.append(petLOSCheckW = new WidgetBoolean(petLOSCheckB, "Targeting requires LOS"));
        petSettings.append(petTickScanRangeXI = new SettingInt("petTickScanRangeX", 20, 0, 200));
        petScreen.append(petTickScanRangeXW = new WidgetInt(petTickScanRangeXI, "TickScanRangeX"));
        petSettings.append(petTickScanRangeYI = new SettingInt("petTickScanRangeY", 8, 0, 200));
        petScreen.append(petTickScanRangeYW = new WidgetInt(petTickScanRangeYI, "TickScanRangeY"));
        petSettings.append(petTickScanRangeZI = new SettingInt("petTickScanRangeZ", 20, 0, 200));
        petScreen.append(petTickScanRangeZW = new WidgetInt(petTickScanRangeZI, "TickScanRangeZ"));
        petScreen.append(blahW = new Widget());
        petScreen.append(blahW = new Widget());
        petSettings.append(petHealthInitI = new SettingInt("petHealthInit", 80, 0, 5, 9999));
        petScreen.append(petHealthInitW = new WidgetInt(petHealthInitI, "petHealthInitI"));
        petSettings.append(petHealFactorF = new SettingFloat("petHealFactor", 4F, 0.0F, 20F));
        petScreen.append(petHealFactorW = new WidgetFloat(petHealFactorF, "petHealFactorF"));
        petSettings.append(petAutoHeal = new SettingBoolean("petAutoHeal", false));
        petScreen.append(petAutoHealW = new WidgetBoolean(petAutoHeal, "Pet Auto Heal"));
        petScreen.append(blahW = new Widget());
        petScreen.append(blahW = new Widget());
        petScreen.append(blahW = new Widget());
        petSettings.append(petSkeleCooldownI = new SettingInt("petSkeleCooldown", 8, 0, 200));
        petScreen.append(petSkeleCooldownW = new WidgetInt(petSkeleCooldownI, "Pet skele cooldown"));
        petSettings.append(petSkeleRangeI = new SettingInt("petSkeleRange", 12, 0, 200));
        petScreen.append(petSkeleRangeW = new WidgetInt(petSkeleRangeI, "Pet skele range"));
        petSettings.append(petSkeleAccuracyF = new SettingFloat("petSkeleAccuracy", 15F, 0.0F, 200F));
        petScreen.append(petSkeleAccuracyW = new WidgetFloat(petSkeleAccuracyF, "Pet skele aim"));
        petSettings.append(enhPetCooldownI = new SettingInt("enhPetCooldownI", 5, 0, 200));
        petScreen.append(enhPetCooldownW = new WidgetInt(enhPetCooldownI, "Enh pet cooldown"));
        petSettings.append(enhPetDamageF = new SettingFloat("enhPetDamageF", 1.0F, 0.0F, 20F));
        petScreen.append(enhPetDamageW = new WidgetFloat(enhPetDamageF, "Enh pet damage x"));
        petSettings.append(enhPetSpeedMultiplierF = new SettingFloat("enhPetSpeedMultiplierF", 1.0F, 0.0F, 20F));
        petScreen.append(enhPetSpeedMultiplierW = new WidgetFloat(enhPetSpeedMultiplierF, "Enh pet speed x"));
        petScreen.append(blahW = new Widget());
        petScreen.append(blahW = new Widget());
        petSettings.append(NothingPushesPlayer = new SettingBoolean("NothingPushesPlayer", true));
        petScreen.append(NothingPushesPlayerW = new WidgetBoolean(NothingPushesPlayer, "Nothing pushes player"));
        petSettings.append(healthBarsLOS = new SettingBoolean("healthBarsLOS", false));
        petScreen.append(healthBarsLOSW = new WidgetBoolean(healthBarsLOS, "Health always visible"));
        petScreen.append(blahW = new Widget());
        petScreen.append(blahW = new Widget());
        petSettings.append(timeControlB = new SettingBoolean("timeControl", true));
        petScreen.append(timeControlW = new WidgetBoolean(timeControlB, "NP3&6 time keys"));
        petSettings.append(killAllPetsB = new SettingBoolean("killAllPets", false));
        petScreen.append(killAllPetsW = new WidgetBoolean(killAllPetsB, "Kill pets, re-disable"));
        petScreen.append(blahW = new Widget());
        petScreen.append(blahW = new Widget());
        petSettings.append(forceRevive = new SettingBoolean("forceRevive", false));
        petScreen.append(forceReviveW = new WidgetBoolean(forceRevive, "FIX STUCK BUG"));
        SimpleButtonModel simplebuttonmodel = new SimpleButtonModel();
        simplebuttonmodel.addActionCallback(new ModAction(petSettings, "resetAll", new Class[0]));
        Button button = new Button(simplebuttonmodel);
        button.setText("Reset all to defaults");
        petScreen.append(button);
        //petSettings.load();
        //NMSettings = new ModSettings("Nightmare Mode Settings");
        NMScreen = new ModSettingScreen("Nightmare Mode");
        petSettings.append(EnableNMModeB = new SettingBoolean("EnableNMModeB", true));
        NMScreen.append(EnableNMModeW = new WidgetBoolean(EnableNMModeB, "Enable Nightmare Mode"));
        NMScreen.append(blahW = new Widget());
        NMScreen.append(blahW = new Widget());
        NMScreen.append(blahW = new Widget());
        petSettings.append(maxHostilesI = new SettingInt("maxHostiles", 100, 0, 5, 1000));
        NMScreen.append(maxHostilesW = new WidgetInt(maxHostilesI, "Max hostiles"));
        petSettings.append(maxAnimalsI = new SettingInt("maxAnimals", 20, 0, 5, 1000));
        NMScreen.append(maxAnimalsW = new WidgetInt(maxAnimalsI, "Max animals"));
        petSettings.append(maxWaterCreaturesI = new SettingInt("maxWaterCreatures", 10, 0, 5, 1000));
        NMScreen.append(maxWaterCreaturesW = new WidgetInt(maxWaterCreaturesI, "Max sea cr."));
        NMScreen.append(blahW = new Widget());
        NMScreen.append(blahW = new Widget());
        NMScreen.append(blahW = new Widget());
        petSettings.append(defaultTargetPlayerB = new SettingBoolean("defaultTargetPlayer", true));
        NMScreen.append(defaultTargetPlayerW = new WidgetBoolean(defaultTargetPlayerB, "Auto atk player"));
        petSettings.append(creepersExplodeIfStuckB = new SettingBoolean("creepersExplodeIfStuck", false));
        NMScreen.append(creepersExplodeIfStuckW = new WidgetBoolean(creepersExplodeIfStuckB, "Auto-Explode Creepers"));
        petSettings.append(hostilesAttackAnimalsB = new SettingBoolean("hostilesAttackAnimals", true));
        NMScreen.append(hostilesAttackAnimalsW = new WidgetBoolean(hostilesAttackAnimalsB, "Orig. ents attack animals"));
        petSettings.append(hostileLOSCheckB = new SettingBoolean("hostileLOSCheck", true));
        NMScreen.append(hostileLOSCheckW = new WidgetBoolean(hostileLOSCheckB, "Targeting needs LOS"));
        NMScreen.append(blahW = new Widget());
        NMScreen.append(blahW = new Widget());
        petSettings.append(VerticalCollision = new SettingBoolean("VerticalCollision", true));
        NMScreen.append(VerticalCollisionW = new WidgetBoolean(VerticalCollision, "Y-axis collision"));
        petSettings.append(DamageCooldown = new SettingBoolean("DamageCooldown", true));
        NMScreen.append(DamageCooldownW = new WidgetBoolean(DamageCooldown, "Damage cooldown"));
        petSettings.append(fireImmuneHostiles = new SettingBoolean("fireImmuneHostiles", false));
        NMScreen.append(fireImmuneHostilesW = new WidgetBoolean(fireImmuneHostiles, "Fire immune hostiles"));
        petSettings.append(fireSpreadsOnEnts = new SettingBoolean("fireSpreadsOnEnts", false));
        NMScreen.append(fireSpreadsOnEntsW = new WidgetBoolean(fireSpreadsOnEnts, "Ents spread fire"));
        petSettings.append(unlimitedEntityRenderRange = new SettingBoolean("unlimitedEntityRenderRange", false));
        NMScreen.append(unlimitedEntityRenderRangeW = new WidgetBoolean(unlimitedEntityRenderRange, "Unl. ent render dist"));
        NMScreen.append(blahW = new Widget());
        NMScreen.append(blahW = new Widget());
        NMScreen.append(blahW = new Widget());
        petSettings.append(NaziB = new SettingBoolean("NaziB", true));
        NMScreen.append(NaziW = new WidgetBoolean(NaziB, "Enable Zombie Nazi"));
        petSettings.append(KnightB = new SettingBoolean("KnightB", true));
        NMScreen.append(KnightW = new WidgetBoolean(KnightB, "Enable Zombie Knight"));
        petSettings.append(hostilesBreakWallsB = new SettingBoolean("hostilesBreakWalls", true));
        NMScreen.append(hostilesBreakWallsW = new WidgetBoolean(hostilesBreakWallsB, "Enable Zombie Miner"));
        petSettings.append(MiningZombieDigPower = new SettingFloat("MiningZombieDigPower", 2.8F, 0.0F, 0.1F, 50F));
        NMScreen.append(MiningZombieDigPowerW = new WidgetFloat(MiningZombieDigPower, "Zombie dig power"));
        NMScreen.append(blahW = new Widget());
        NMScreen.append(blahW = new Widget());
        petSettings.append(hostileTickScanRangeXI = new SettingInt("hostileTickScanRangeXI", 60, 0, 200));
        NMScreen.append(hostileTickScanRangeXW = new WidgetInt(hostileTickScanRangeXI, "Scan Range X"));
        petSettings.append(hostileTickScanRangeYI = new SettingInt("hostileTickScanRangeYI", 10, 0, 200));
        NMScreen.append(hostileTickScanRangeYW = new WidgetInt(hostileTickScanRangeYI, "Scan Range Y"));
        petSettings.append(hostileTickScanRangeZI = new SettingInt("hostileTickScanRangeZI", 60, 0, 200));
        NMScreen.append(hostileTickScanRangeZW = new WidgetInt(hostileTickScanRangeZI, "Scan Range Z"));
        NMScreen.append(blahW = new Widget());
        NMScreen.append(blahW = new Widget());
        NMScreen.append(blahW = new Widget());
        petSettings.append(mobSpawnerStartRangeI = new SettingInt("mobSpawnerStartRangeI", 50, 0, 200));
        NMScreen.append(mobSpawnerStartRangeW = new WidgetInt(mobSpawnerStartRangeI, "spn bl. act dist"));
        petSettings.append(mobSpawnerSpawnAreaXI = new SettingInt("mobSpawnerSpawnAreaXI", 32, 0, 200));
        NMScreen.append(mobSpawnerSpawnAreaXW = new WidgetInt(mobSpawnerSpawnAreaXI, "mobSpawnAreaX"));
        petSettings.append(mobSpawnerSpawnAreaYI = new SettingInt("mobSpawnerSpawnAreaYI", 12, 0, 200));
        NMScreen.append(mobSpawnerSpawnAreaYW = new WidgetInt(mobSpawnerSpawnAreaYI, "mobSpawnAreaY"));
        petSettings.append(mobSpawnerSpawnAreaZI = new SettingInt("mobSpawnerSpawnAreaZI", 32, 0, 200));
        NMScreen.append(mobSpawnerSpawnAreaZW = new WidgetInt(mobSpawnerSpawnAreaZI, "mobSpawnAreaZ"));
        petSettings.append(mobSpawnerMaxEntsInAreaI = new SettingInt("mobSpawnerMaxEntsInAreaI", 16, 0, 200));
        NMScreen.append(mobSpawnerMaxEntsInAreaW = new WidgetInt(mobSpawnerMaxEntsInAreaI, "mobSpawnMaxEnts"));
        NMScreen.append(blahW = new Widget());
        NMScreen.append(blahW = new Widget());
        NMScreen.append(blahW = new Widget());
        petSettings.append(mobSpawnerSpawnRateFixedI = new SettingInt("mobSpawnerSpawnRateFixedI", 200, 0, 20, 10000));
        NMScreen.append(mobSpawnerSpawnRateFixedW = new WidgetInt(mobSpawnerSpawnRateFixedI, "SpawnRateFixed"));
        petSettings.append(mobSpawnerSpawnRateRandomI = new SettingInt("mobSpawnerSpawnRateRandomI", 100, 0, 20, 10000));
        NMScreen.append(mobSpawnerSpawnRateRandomW = new WidgetInt(mobSpawnerSpawnRateRandomI, "SpawnRateRandom"));
        NMScreen.append(blahW = new Widget());
        NMScreen.append(blahW = new Widget());
        
        petSettings.append(hostileHumans = new SettingBoolean("hostileHumans", false));
        NMScreen.append(hostileHumansW = new WidgetBoolean(hostileHumans, "Hostile Humans+"));
        
        NMScreen.append(blahW = new Widget());
        NMScreen.append(blahW = new Widget());
        NMScreen.append(blahW = new Widget());
        
        simplebuttonmodel.addActionCallback(new ModAction(petSettings, "resetAll", new Class[0]));
        button = new Button(simplebuttonmodel);
        button.setText("Reset all to defaults");
        NMScreen.append(button);
        petSettings.load();
        run();
        petFollowRange = petFollowDistNear.get();
        forcePetStayNear = true;
        dbg_prcAI = true;
        dbg_prcPF = true;
        noPF = true;
        allHealthBars = false;
    }

    public void run() {
    	
    }
    
    public static void updateSettings() {
    	//if (true) return;
        System.out.println("Updating game settings");

        if(EnableNMModeB.get()) {
            maxHostiles = maxHostilesI.get();
            maxAnimals = maxAnimalsI.get();
            maxWaterCreatures = maxWaterCreaturesI.get();
            defaultTargetPlayer = defaultTargetPlayerB.get();
            hostilesBreakWalls = hostilesBreakWallsB.get();
            creepersExplodeIfStuck = creepersExplodeIfStuckB.get();
            hostilesAttackAnimals = hostilesAttackAnimalsB.get();
            hostileLOSCheck = hostileLOSCheckB.get();
            hostileTickScanRangeX = hostileTickScanRangeXI.get();
            hostileTickScanRangeY = hostileTickScanRangeYI.get();
            hostileTickScanRangeZ = hostileTickScanRangeZI.get();
            mobSpawnerStartRange = mobSpawnerStartRangeI.get();
            mobSpawnerSpawnAreaX = mobSpawnerSpawnAreaXI.get();
            mobSpawnerSpawnAreaY = mobSpawnerSpawnAreaYI.get();
            mobSpawnerSpawnAreaZ = mobSpawnerSpawnAreaZI.get();
            mobSpawnerMaxEntsInArea = mobSpawnerMaxEntsInAreaI.get();
            mobSpawnerSpawnRateFixed = mobSpawnerSpawnRateFixedI.get();
            mobSpawnerSpawnRateRandom = mobSpawnerSpawnRateRandomI.get();
            
            int i = worldRef.loadedEntityList.size();
            for(int j = 0; j < i; j++) {
                Entity entity = (Entity)worldRef.loadedEntityList.get(j);

                if(!(entity instanceof EntityLiving)) {
                    continue;
                }

                EntityLiving entityliving = (EntityLiving)entity;
                
                if(isNobleHuman(entityliving) && hostileHumans.get()) {
                    entityliving.canSwitchTarget = true;
                }
            }
                
            
            
        } else {
            maxHostiles = 80;
            maxAnimals = 20;
            maxWaterCreatures = 10;
            defaultTargetPlayer = false;
            hostilesBreakWalls = false;
            creepersExplodeIfStuck = false;
            hostilesAttackAnimals = false;
            hostileLOSCheck = true;
            hostileTickScanRangeX = 16D;
            hostileTickScanRangeY = 16D;
            hostileTickScanRangeZ = 16D;
            mobSpawnerStartRange = 16F;
            mobSpawnerSpawnAreaX = 8D;
            mobSpawnerSpawnAreaY = 6D;
            mobSpawnerSpawnAreaZ = 8D;
            mobSpawnerMaxEntsInArea = 5;
            mobSpawnerSpawnRateFixed = 200F;
            mobSpawnerSpawnRateRandom = 600F;
            VerticalCollision.set(false, petSettings.currentContext);
            NothingPushesPlayer.set(false, petSettings.currentContext);
            DamageCooldown.set(true, petSettings.currentContext);
            NaziB.set(false, petSettings.currentContext);
            KnightB.set(false, petSettings.currentContext);
            
            int i = worldRef.loadedEntityList.size();
            for(int j = 0; j < i; j++) {
                Entity entity = (Entity)worldRef.loadedEntityList.get(j);

                if(!(entity instanceof EntityLiving)) {
                    continue;
                }

                EntityLiving entityliving = (EntityLiving)entity;
                
                if(isNobleHuman(entityliving)) {
                    entityliving.canSwitchTarget = false;
                }
            }
        }

        try {
            ModLoader.setPrivateValue(EnumCreatureType.class, EnumCreatureType.monster, "e", Integer.valueOf(maxHostiles));
            ModLoader.setPrivateValue(EnumCreatureType.class, EnumCreatureType.creature, "e", Integer.valueOf(maxAnimals));
            ModLoader.setPrivateValue(EnumCreatureType.class, EnumCreatureType.waterCreature, "e", Integer.valueOf(maxWaterCreatures));
        } catch(Exception exception) { }

        petLOSCheck = petLOSCheckB.get();
        petTickScanRangeX = petTickScanRangeXI.get();
        petTickScanRangeY = petTickScanRangeYI.get();
        petTickScanRangeZ = petTickScanRangeZI.get();
        petHealthInit = petHealthInitI.get();
        petHealFactor = petHealFactorF.get();
        petSkeleCooldown = petSkeleCooldownI.get();
        petSkeleRange = petSkeleRangeI.get();
        petSkeleAccuracy = petSkeleAccuracyF.get();
        enhPetCooldown = enhPetCooldownI.get();
        enhPetDamage = enhPetDamageF.get();
        enhPetSpeedMultiplier = enhPetSpeedMultiplierF.get();
        timeControl = timeControlB.get();
        killAllPets = killAllPetsB.get();
    }

    public mod_AIManager() {
        spriteIndex = ModLoader.getUniqueSpriteIndex("/gui/items.png");
        usedSpriteIndex = ModLoader.getUniqueSpriteIndex("/gui/items.png");
        
        domrod = (new DominationRod(22501, 0)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/dominationrod/item.png")).setItemName("dominationrod");
        domrod_enhanced = (new DominationRod(22502, 1)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/dominationrod/enhanced_rod.png")).setItemName("dominationrod_enhanced");
        
        //public static final Item itemBulletM1911 = (new SdkZcItemCustomStackSize(ITEM_ID_OFFSET, (int)(8*ammoFactor))).setIconIndex(ModLoader.addOverride("/gui/items.png", "/sdkzc/itemBulletM1911.png")).setItemName("zcBulletM1911");
        
        //conviniece methods
        //jumpFactor = settings.addSetting(screen, "Jump factor", "jump_factor", 0.35f, 0.1f, 0.05f, 1f);
        
        ModLoader.AddName(domrod, "Domination Rod");
        ModLoader.AddName(domrod_enhanced, "Domination Rod Enhanced");
        
        
        //petScreen.thewidget.BackButton.getModel().addActionCallback(this);
        //NMScreen.thewidget.BackButton.getModel().addActionCallback(this);
        System.out.println("mod_AIManager constructor");
        ModLoader.RegisterEntityID(EntFetcher.class, "EntFetcher", ModLoader.getUniqueEntityId());
        ModLoader.RegisterEntityID(EntityZombieKnight.class, "ZombieKnight", ModLoader.getUniqueEntityId());
        ModLoader.RegisterEntityID(EntityZombieNazi.class, "ZombieNazi", ModLoader.getUniqueEntityId());
        ModLoader.RegisterEntityID(EntityZombieMiner.class, "ZombieMiner", ModLoader.getUniqueEntityId());
        spawnlist.add("Surface biomes", 0, new Object[] {
                          "ZombieKnight", "ZombieNazi", "ZombieMiner"
                      });
        
        try {
        	
            //((WidgetClassicWindow)NMScreen.thewidget).BackButton.getModel().addActionCallback(this);
            Method m = ModLoader.class.getDeclaredMethod("SetInGameHook", new Class[] { BaseMod.class, Boolean.TYPE, Boolean.TYPE });
            m.invoke(null, new Object[] { this, Boolean.valueOf(true), Boolean.valueOf(false) });
            //petScreen.thewidget.BackButton.getModel().addActionCallback(this);
            
            } catch (Throwable e) { e.printStackTrace();
            	
          }
    
            
            
    }

    public static void uh() {
    }

    public static boolean playerDistCheck(EntityLiving entityliving) {
        if(theplayer == null) {
            return false;
        }

        float f = entityliving.getDistanceToEntity(theplayer);
        return f <= safetyDistanceCutoff;
    }

    public void RegisterTextureOverrides() {
        ModLoader.addOverride("/gui/items.png", "/dominationrod/item.png", spriteIndex);
        ModLoader.addOverride("/gui/items.png", "/dominationrod/enhanced_rod.png", usedSpriteIndex);
    }

    public void AddRenderer(Map map) {
        map.put(EntFetcher.class, new RenderEntity());
        map.put(EntityZombieKnight.class, new RenderBiped(new ModelBiped(), 0.5F));
        map.put(EntityZombieNazi.class, new RenderBiped(new ModelBiped(), 0.5F));
        map.put(EntityZombieMiner.class, new RenderBiped(new ModelBiped(), 0.5F));
    }

    public void AddEntityID() {
    }

    public void AddRecipes(CraftingManager craftingmanager) {
        craftingmanager.addRecipe(new ItemStack(domrod_enhanced, 1), new Object[] {
                                      "D  ", " I ", "  #", Character.valueOf('D'), Item.diamond, Character.valueOf('I'), Item.stick, Character.valueOf('#'), Item.lightStoneDust
                                  });
        craftingmanager.addRecipe(new ItemStack(domrod, 1), new Object[] {
                                      "D  ", "DI ", "  D", Character.valueOf('D'), Item.silk, Character.valueOf('I'), Item.stick
                                  });
    }

    public static void reset() {
        EntFetcher.fixed = false;
    }

    public static void displayMessage(String s, int i) {
        msg = s;
        timeout = 55;
        color = i;
    }

    public static void displayMessage(String s) {
        displayMessage(s, defaultColor);
    }
    
    public void OnTickInGame(Minecraft game)
    {
    	//System.out.println("game");
    	OSDHook(game, false);
    }
    
    public void OnTickInGUI(Minecraft game, GuiScreen gui)
    {
    	System.out.println("Gui");
    }

    public void OSDHook(Minecraft minecraft, boolean flag) {
    	
    	
        if(timeout > 0 && msg != null) {
            ScaledResolution scaledresolution = new ScaledResolution(minecraft.displayWidth, minecraft.displayHeight);
            int i = scaledresolution.getScaledWidth();
            int j = scaledresolution.getScaledHeight();
            int k = minecraft.fontRenderer.getStringWidth(msg);
            minecraft.fontRenderer.drawStringWithShadow(msg, 3, 85, 0xffffff);
            timeout--;
        }

        if(mc == null) {
            mc = minecraft;
        }

        if(forceRevive.get() && theplayer != null) {
            EntityPlayer entityplayer = theplayer;
            EntityPlayer entityplayer1 = entityplayer;
            entityplayer1.isDead = false;

            if(entityplayer1 instanceof EntityLiving) {
                entityplayer.health = 20;
                entityplayer.hurtTime = 0;
                entityplayer.deathTime = 0;
            }

            entityplayer1.preparePlayerToSpawn();

            if(!mc.theWorld.loadedEntityList.contains(entityplayer1)) {
                mc.theWorld.entityJoinedWorld(entityplayer1);
            }

            mc.currentScreen = null;
            entityplayer1.ridingEntity = null;
            entityplayer.mountEntID = -1;
            forceRevive.set(false, petSettings.currentContext);
        }
    }

    public static void entInit(World world, EntityLiving entityliving) {
        entityliving.maxhealth = entityliving.health;
        entityliving.guardEnt = entityliving;

        if(entityliving instanceof EntityMobs) {
            entityliving.team = hostileTeamInit;

            if(isOrigMob(entityliving) || (isNobleHuman(entityliving) && hostileHumans.get())) {
                entityliving.canSwitchTarget = true;
            }
        } else if(entityliving instanceof EntityPlayer) {
            theplayer = (EntityPlayer)entityliving;
            worldRef = theplayer.worldObj;
            System.out.println("entinit player");

            if(theplayer == null) {
                System.out.println("theplayer NULL?");
                theplayer = entityliving.worldObj.getClosestPlayerToEntity(entityliving, -1D);
            }

            if(theplayer == null) {
                System.out.println("theplayer STILL NULL?");
            }

            entityliving.team = playerTeamInit;
            entityliving.maxhealth = 20;
            entityliving.orders = 0;
        } else if(entityliving instanceof EntityAnimals) {
            entityliving.team = animalTeamInit;
        }
    }

    public static void entSaved(EntityLiving entityliving, NBTTagCompound nbttagcompound) {
        nbttagcompound.setShort("uID", (short)entityliving.uID);
        nbttagcompound.setShort("MobType", (short)entityliving.mobtype);
        nbttagcompound.setShort("Team", (short)entityliving.team);
        nbttagcompound.setShort("Orders", (short)entityliving.orders);
        nbttagcompound.setShort("guardX", (short)entityliving.guardX);
        nbttagcompound.setShort("guardY", (short)entityliving.guardY);
        nbttagcompound.setShort("guardZ", (short)entityliving.guardZ);
        nbttagcompound.setShort("enhanced", (short)entityliving.enhanced);
        nbttagcompound.setShort("guardEntID", (short)entityliving.guardEntID);
        nbttagcompound.setShort("mineDelay", (short)entityliving.mineDelay);

        if(entityliving.ridingEntity != null && (entityliving.ridingEntity instanceof EntityLiving) && ((EntityLiving)entityliving.ridingEntity).uID == -1) {
            ((EntityLiving)entityliving.ridingEntity).uID = getUniqueEntID();
            entityliving.mountEntID = ((EntityLiving)entityliving.ridingEntity).uID;
        }

        nbttagcompound.setShort("mountEntID", (short)entityliving.mountEntID);
    }

    public static void entLoaded(EntityLiving entityliving, NBTTagCompound nbttagcompound) {
        entityliving.uID = nbttagcompound.getShort("uID");
        entityliving.mobtype = nbttagcompound.getShort("MobType");
        entityliving.team = nbttagcompound.getShort("Team");
        entityliving.orders = nbttagcompound.getShort("Orders");
        entityliving.guardX = nbttagcompound.getShort("guardX");
        entityliving.guardY = nbttagcompound.getShort("guardY");
        entityliving.guardZ = nbttagcompound.getShort("guardZ");
        entityliving.enhanced = nbttagcompound.getShort("enhanced");
        entityliving.guardEntID = nbttagcompound.getShort("guardEntID");
        entityliving.mountEntID = nbttagcompound.getShort("mountEntID");
        entityliving.mineDelay = nbttagcompound.getShort("mineDelay");

        if(entityliving instanceof EntityMobs) {
            entityliving.maxhealth = 20;
        } else if(entityliving instanceof EntityPlayer) {
            entityliving.maxhealth = 20;
            firstTick = true;
            entityliving.team = playerTeamInit;
        } else if(entityliving instanceof EntityAnimals) {
            entityliving.maxhealth = 10;
        }

        if(entityliving.health > entityliving.maxhealth) {
            entityliving.maxhealth = entityliving.health;
        }

        if(isGuardian(entityliving)) {
            entityliving.noTick = true;
        }
    }

    public static void convert(EntityLiving entityliving, int i) {
        ItemStack itemstack = theplayer.inventory.getCurrentItem();
        entityliving.team = playerTeamInit;
        entityliving.enhanced = i;

        if(isGuardian(entityliving)) {
            entityliving.noTick = true;
        }

        if(entityliving.enhanced == 1) {
            displayMessage((new StringBuilder()).append("ENHANCE!").append("").toString());

            if(petHealthInit > entityliving.health) {
                entityliving.health = petHealthInit;
            }

            entityliving.maxhealth = entityliving.health;

            if(entityliving instanceof EntityMobs) {
                ((EntityMobs)entityliving).attackStrength *= enhPetDamage;
            }
        } else {
            entityliving.health = entityliving.maxhealth;
        }

        entityliving.orders = 1;
        entityliving.fire = 0;
        entityliving.deathTime = 0;

        if(entityliving instanceof EntityCreature) {
            ((EntityCreature)entityliving).playerToAttack = null;
        }

        if(itemstack != null) {
            itemstack.damageItem(10);
        }
    }

    public static void foundEnt(EntityLiving entityliving, int i) {
        if(entityliving.team != playerTeamInit && selAIOrder != 7) {
            convert(entityliving, i);
        } else if(entityliving.team == playerTeamInit || selAIOrder == 7) {
            giveOrder(entityliving);
        }
    }
    
    public static boolean isMountable(Entity entity) {
    	try {
    		return (entity instanceof EntityBoat) ||
    	(entity instanceof EntityMinecart) ||
    	(Class.forName("EntityBiplane").isInstance(entity)) ||
    	(Class.forName("EntityCamel").isInstance(entity)) ||
    	(Class.forName("EntityFokker").isInstance(entity));
    	} catch(Exception exception) {
    		exception.printStackTrace();
            return false;
        }
    }

    public static void giveOrder(Entity entity) {
        EntityLiving entityliving = null;
        boolean flag = false;

        if(entity instanceof EntityLiving) {
            entityliving = (EntityLiving)entity;
        } else if(selAIOrder == 6 && isMountable(entity)) {
            flag = true;
        } else {
            return;
        }

        if(selAIOrder == 6) {
            if(orderState == 0) {
                if(!flag) {
                    orderState++;
                    orderedEnt = entityliving;
                    displayMessage((new StringBuilder()).append("Select ent to mount ").toString());
                }
            } else {
                orderedEnt.mountEntity(entity);

                if(!flag) {
                    ((EntityLiving)orderedEnt).mountEntID = entityliving.uID;
                }

                orderState = 0;
                displayMessage((new StringBuilder()).append("Stacked!").toString());
            }

            return;
        }

        if(selAIOrder == 7) {
            System.out.println("help!");
            callForHelp(theplayer, entityliving);
            displayMessage((new StringBuilder()).append("Attacking target").toString());
        }

        if(entityliving.team == playerTeamInit || (entityliving instanceof EntityAnimals)) {
            String s = "";
            String s1 = "";

            if(selAIOrder < 5) {
                entityliving.orders = selAIOrder;
                entityliving.guardX = -1;
                entityliving.guardY = -1;
                entityliving.guardZ = -1;
            }

            if(selAIOrder == 3) {
                s1 = "wander";

                if(entityliving instanceof EntityCreature) {
                    ((EntityCreature)entityliving).playerToAttack = null;
                }
            } else if(selAIOrder == 1) {
                s1 = "follow";
                entityliving.guardEnt = theplayer;
                entityliving.guardEntID = theplayer.uID;
            } else if(selAIOrder == 2) {
                s1 = "stay";

                if(entityliving instanceof EntityCreature) {
                    ((EntityCreature)entityliving).playerToAttack = null;
                }
            } else if(selAIOrder == 4) {
                s1 = "guard area";

                if(entityliving instanceof EntityCreature) {
                    ((EntityCreature)entityliving).playerToAttack = null;
                }

                entityliving.guardX = (int)entityliving.posX;
                entityliving.guardY = (int)entityliving.posY;
                entityliving.guardZ = (int)entityliving.posZ;
            } else if(selAIOrder == 5) {
                if(orderState == 0) {
                    orderState++;
                    orderedEnt = entityliving;
                    displayMessage((new StringBuilder()).append("Select ent to guard ").toString());
                } else {
                    ((EntityLiving)orderedEnt).guardEnt = entityliving;
                    ((EntityLiving)orderedEnt).guardEntID = entityliving.uID;
                    ((EntityLiving)orderedEnt).orders = 1;
                    orderState = 0;
                    displayMessage((new StringBuilder()).append("GuardEnt Set").toString());
                }
            }

            if(selAIOrder < 5) {
                float f = entityliving.getDistanceToEntity(theplayer);
                displayMessage((new StringBuilder()).append("Ordered to ").append(s1).append(", Dist: ").append(f).toString());
            }
        }
    }

    public static void enhAttack(EntityLiving entityliving, Entity entity, float f) {
        try {
            if(entityliving instanceof EntitySkeleton) {
                skeleAttack(entityliving, entity, f);
            } else if(isOrigMob(entityliving)) {
                mobAttack((EntityMobs)entityliving, entity, f);
            } else if(entityliving instanceof EntityCreature) {
                ((EntityCreature)entityliving).attackEntity(entity, f);
            }
        } catch(Exception exception) { }
    }

    public static void mobAttack(EntityMobs entitymobs, Entity entity, float f) {
        if((double)f < 2.5D && entity.boundingBox.maxY > entitymobs.boundingBox.minY && entity.boundingBox.minY < entitymobs.boundingBox.maxY) {
            entitymobs.attackTime = enhPetCooldown;
            entity.attackEntityFrom(entitymobs, entitymobs.attackStrength);
        }
    }

    public static void skeleAttack(EntityLiving entityliving, Entity entity, float f) {
        byte byte0 = 1;
        EntityLiving entityliving1 = (EntityLiving)entity;
        float f1 = 10F;
        int i = 30;
        float f2 = 12F;

        if(entityliving.team == playerTeamInit) {
            f1 = petSkeleRange;
            i = petSkeleCooldown;
            f2 = petSkeleAccuracy;
            byte0 = 2;
        }

        if(f < f1 && entityliving.team != entityliving1.team) {
            double d = entity.posX - entityliving.posX;
            double d1 = entity.posZ - entityliving.posZ;

            if(entityliving.attackTime == 0) {
                EntityArrow entityarrow = null;

                for(int j = 0; j < byte0; j++) {
                    if(entityarrow == null) {
                        entityarrow = new EntityArrow(entityliving.worldObj, entityliving);
                    }

                    entityarrow.posY += 0.3999999761581421D;
                    double d2 = entity.posY - 0.20000000298023221D - entityarrow.posY;
                    float f3 = MathHelper.sqrt_double(d * d + d1 * d1) * 0.5F;
                    entityliving.worldObj.entityJoinedWorld(entityarrow);
                    entityarrow.setArrowHeading(d, d2 + (double)f3, d1, 0.6F, f2);
                }

                entityliving.worldObj.playSoundAtEntity(entityliving, "random.bow", 1.0F, 1.0F / (entityliving.rand.nextFloat() * 0.4F + 0.8F));
                entityliving.attackTime = i;
            }

            entityliving.rotationYaw = (float)((Math.atan2(d1, d) * 180D) / 3.1415927410125728D) - 90F;
            ((EntityCreature)entityliving).hasAttacked = true;
        }
    }

    public static boolean entHit(EntityLiving entityliving, int i, EntityLiving entityliving1) {
        if(entityliving != null) {
            if(entityliving instanceof EntityPlayer) {
                ItemStack itemstack = theplayer.inventory.getCurrentItem();

                if(itemstack != null) {
                    Item item = itemstack.getItem();

                    if(entityliving1.team != playerTeamInit) {
                        if(item instanceof DominationRod) {
                            convert(entityliving1, ((DominationRod)item).type);

                            if(selAIOrder == 6) {
                                theplayer.mountEntity(entityliving1);
                            }

                            return false;
                        }
                    } else {
                        try {
                            Field field = (ItemFood.class).getDeclaredField("a");
                            field.setAccessible(true);
                            int j = (int)(field.getFloat(item) * (petHealFactor * (float)entityliving1.enhanced));

                            if(j > 0) {
                                int k = entityliving1.health;
                                heal(entityliving1, j);

                                if(k != entityliving1.health) {
                                    itemstack.stackSize--;
                                }

                                return false;
                            }

                            if(item instanceof DominationRod) {
                                if(selAIOrder == 6) {
                                    theplayer.mountEntity(entityliving1);
                                }

                                return false;
                            }
                        } catch(Exception exception) {
                            if(!(exception instanceof SecurityException)) {
                                if(!(exception instanceof NoSuchFieldException));
                            }
                        }
                    }
                } else {
                    return true;
                }
            } else if(entityliving.team == playerTeamInit && entityliving1.team == playerTeamInit) {
                return false;
            }
        }

        return true;
    }

    public static void heal(EntityLiving entityliving, int i) {
        if(entityliving.health <= 0) {
            return;
        }

        entityliving.health += i;

        if(entityliving.health > entityliving.maxhealth) {
            entityliving.health = entityliving.maxhealth;
        }

        entityliving.field_9306_bj = entityliving.field_9366_o / 2;
    }

    public static void postEntInit(EntityLiving entityliving) {
        int i = entityliving.worldObj.loadedEntityList.size();

        for(theplayer = null; theplayer == null; theplayer = ModLoader.getMinecraftInstance().thePlayer) {
            worldRef = ModLoader.getMinecraftInstance().theWorld;
        }

        System.out.println((new StringBuilder()).append("EntCount").append(i).toString());

        for(int j = 0; j < i; j++) {
            Entity entity = (Entity)entityliving.worldObj.loadedEntityList.get(j);

            if(!(entity instanceof EntityLiving)) {
                continue;
            }

            EntityLiving entityliving1 = (EntityLiving)entity;

            if(entityliving1.uID == -1) {
                entityliving1.uID = getUniqueEntID();
            }

            if(entityliving1.guardEntID != -1) {
                EntityLiving entityliving2 = getEnt(entityliving1.guardEntID);

                if(entityliving2 != null) {
                    if(entityliving2 != entityliving1 && entityliving1.guardEntID != entityliving1.uID) {
                        System.out.println((new StringBuilder()).append("GuardEnt found!: ").append(entityliving1.uID).append(" guarding ").append(entityliving1.guardEntID).toString());
                        entityliving1.guardEnt = entityliving2;
                    } else {
                        entityliving1.uID = getUniqueEntID();
                    }
                } else {
                    entityliving1.guardEnt = theplayer;
                }
            } else {
                entityliving1.guardEnt = theplayer;
            }

            if(entityliving1.mountEntID == -1) {
                continue;
            }

            EntityLiving entityliving3 = getEnt(entityliving1.mountEntID);

            if(entityliving3 == null) {
                continue;
            }

            if(entityliving3 != entityliving1 && entityliving1.mountEntID != entityliving1.uID) {
                System.out.println((new StringBuilder()).append("Stack found!: ").append(entityliving1.uID).append(" onto ").append(entityliving1.mountEntID).toString());
                entityliving1.mountEntity(entityliving3);
            } else {
                entityliving1.uID = getUniqueEntID();
            }
        }
    }

    public static EntityLiving getEnt(long l) {
        int i = worldRef.loadedEntityList.size();
        Object obj = null;

        for(int j = 0; j < i; j++) {
            Entity entity = (Entity)worldRef.loadedEntityList.get(j);

            if(!(entity instanceof EntityLiving)) {
                continue;
            }

            EntityLiving entityliving = (EntityLiving)entity;

            if((long)entityliving.uID == l) {
                return entityliving;
            }
        }

        return null;
    }

    public static int getUniqueEntID() {
        boolean flag = true;
        int i = worldRef.loadedEntityList.size();
        int j = 0;

        for(boolean flag1 = true; flag1;) {
            flag1 = false;

            for(int k = 0; k < i; k++) {
                Entity entity = (Entity)worldRef.loadedEntityList.get(k);

                if(!(entity instanceof EntityLiving)) {
                    continue;
                }

                EntityLiving entityliving = (EntityLiving)entity;

                if(entityliving.uID != j) {
                    continue;
                }

                flag1 = true;
                break;
            }

            if(!flag1 || j >= i) {
                flag1 = false;
                j--;
            }

            j++;
        }

        return j;
    }

    public static void PostTick(EntityLiving entityliving) {
    }

    public static void Tick(EntityLiving entityliving) {
        if(tornado) {
            try {
                //mod_EntAPI.moveToEnt(entityliving, mod_EntAPI.player, 8F, true);
            } catch(Exception exception) { }
        }

        entityliving.PFDelay--;
        
        
        if(entityliving.team == playerTeamInit && (entityliving instanceof EntityCreature)) {
            if(dbg_prcAI && !entityliving.noTick) {
                petTick((EntityCreature)entityliving);
            }
        } else if(entityliving instanceof EntityAnimals) {
            if(dbg_prcAI) {
                animalTick((EntityAnimals)entityliving);
            }
        } else if(entityliving instanceof EntitySlime) {
            if(entityliving.worldObj.difficultySetting == 0 && entityliving.team != playerTeamInit) {
                entityliving.setEntityDead();
            }
        } else if(entityliving instanceof EntityMobs) {
            if(dbg_prcAI) {
                hostileTick((EntityMobs)entityliving);
            }
        } else if(entityliving instanceof EntityCreature) {
            if(dbg_prcAI) {
                animalTick((EntityCreature)entityliving);
            }
        } else if(entityliving instanceof EntityPlayer) {
            if(firstTick && TickCount > 10L) {
                firstTick = false;
                TickCount = 15L;
                System.out.println("Calling postEntInit");
                postEntInit(entityliving);
            }

            if(firstTick) {
                TickCount++;
            }
            
            try {
	        	if(minecraftTicksRan == null)
	    		{
	    			minecraftTicksRan = Minecraft.class.getDeclaredFields()[23];
	    			minecraftTicksRan.setAccessible(true);
	    		}
	        	int ticksRan = minecraftTicksRan.getInt(mc);
	        	//System.out.println(ticksRan);
	        	if (ticksRan-lastTickRun > 50) {
	        		updateSettings();
	        	}
	        	lastTickRun = ticksRan;
	        	//lastSndPosUpdate = ticksRan + 20;
        	} catch (Exception ex) { ex.printStackTrace(); };
        	

            float f = 0.0F;

            try {
                Object obj = ModLoader.getPrivateValue(PlayerControllerSP.class, ModLoader.getMinecraftInstance().playerController, "f");
                float f1 = Float.valueOf(obj.toString()).floatValue();

                if(f1 > 0.01F) {
                    f1 += 0.05F * (float)entityliving.nearbyMinerCount;

                    if(f1 > 1.0F) {
                        f1 = 1.0F;
                    }

                    ModLoader.setPrivateValue(PlayerControllerSP.class, ModLoader.getMinecraftInstance().playerController, "f", Float.valueOf(f1));
                } else if(entityliving.nearbyMinerCount > 2) {
                    ModLoader.setPrivateValue(PlayerControllerSP.class, ModLoader.getMinecraftInstance().playerController, "i", Integer.valueOf(0));
                }

                if(f1 > 0.8F) {
                    List list = entityliving.worldObj.getEntitiesWithinAABBExcludingEntity(entityliving, entityliving.boundingBox.expand(10D, 10D, 10D));
                    entityliving.nearbyMinerCount = 0;

                    if(list != null) {
                        Object obj1 = null;

                        for(int l = 0; l < list.size(); l++) {
                            Entity entity = (Entity)list.get(l);

                            if((entity instanceof EntityZombieMiner) && ((EntityLiving)entity).team == entityliving.team) {
                                entityliving.nearbyMinerCount++;
                            }
                        }
                    }
                }
            } catch(Exception exception1) {
                exception1.printStackTrace();
            }

            if(Keyboard.isKeyDown(nextOrderKey.get()) || Keyboard.isKeyDown(prevOrderKey.get())) {
                if(!keyPressed) {
                    keyPressed = true;

                    if(Keyboard.isKeyDown(nextOrderKey.get())) {
                        selAIOrder++;

                        if(selAIOrder > 7) {
                            selAIOrder = 1;
                        }
                    } else if(Keyboard.isKeyDown(prevOrderKey.get())) {
                        selAIOrder--;

                        if(selAIOrder < 1) {
                            selAIOrder = 7;
                        }
                    }

                    if(selAIOrder == 3) {
                        displayMessage((new StringBuilder()).append("Order: ").append("Wander").toString());
                    } else if(selAIOrder == 1) {
                        displayMessage((new StringBuilder()).append("Order: ").append("Follow").toString());
                    } else if(selAIOrder == 2) {
                        displayMessage((new StringBuilder()).append("Order: ").append("Stay").toString());
                    } else if(selAIOrder == 4) {
                        displayMessage((new StringBuilder()).append("Order: ").append("Guard Area").toString());
                    } else if(selAIOrder == 5) {
                        displayMessage((new StringBuilder()).append("Order: ").append("Guard Entity").toString());
                        orderState = 0;
                    } else if(selAIOrder == 6) {
                        displayMessage((new StringBuilder()).append("Order: ").append("Stack").toString());
                        orderState = 0;
                    } else if(selAIOrder == 7) {
                        displayMessage((new StringBuilder()).append("Order: ").append("Attack Target").toString());
                        orderState = 0;
                    }
                }
            } else if(Keyboard.isKeyDown(Keyboard.getKeyIndex("NUMPAD1"))) {
                if(!keyPressed) {
                    keyPressed = true;
                    dbg_prcAI = !dbg_prcAI;
                    displayMessage((new StringBuilder()).append("dbg_prcAI: ").append(dbg_prcAI).toString());
                }
            } else if(Keyboard.isKeyDown(Keyboard.getKeyIndex("NUMPAD2"))) {
                if(!keyPressed) {
                    keyPressed = true;
                    tornado = !tornado;
                }
            } else if(Keyboard.isKeyDown(forcePetStayNearKey.get())) {
                if(!keyPressed) {
                    keyPressed = true;
                    forcePetStayNear = !forcePetStayNear;
                    displayMessage((new StringBuilder()).append("forcePetStayNear: ").append(forcePetStayNear).toString());
                }
            } else if(Keyboard.isKeyDown(petFollowNearKey.get())) {
                if(!keyPressed) {
                    keyPressed = true;
                    petFollowRange = (float)petFollowDistNear.get() * 1.0F;
                    displayMessage((new StringBuilder()).append("petFollowRange: ").append(petFollowRange).toString());
                }
            } else if(Keyboard.isKeyDown(Keyboard.getKeyIndex("NUMPAD4"))) {
                if(!keyPressed) {
                    keyPressed = true;
                    allHealthBars = !allHealthBars;
                    displayMessage((new StringBuilder()).append("allHealthBars: ").append(allHealthBars).toString());
                }
            } else if(Keyboard.isKeyDown(petFollowFarKey.get())) {
                if(!keyPressed) {
                    keyPressed = true;
                    petFollowRange = (float)petFollowDistFar.get() * 1.0F;
                    displayMessage((new StringBuilder()).append("petFollowRange: ").append(petFollowRange).toString());
                }
            } else if(Keyboard.isKeyDown(Keyboard.getKeyIndex("NUMPAD6"))) {
                if(!keyPressed) {
                    if(timeControl) {
                        entityliving.worldObj.setWorldTime(100L);
                    }

                    keyPressed = true;
                }
            } else if(Keyboard.isKeyDown(Keyboard.getKeyIndex("NUMPAD3"))) {
                if(!keyPressed) {
                    if(timeControl) {
                        entityliving.worldObj.setWorldTime(-10400L);
                    }

                    keyPressed = true;
                }
            } else if(Keyboard.isKeyDown(Keyboard.getKeyIndex("NUMPAD7"))) {
                int i = 0;
                int j = entityliving.worldObj.loadedEntityList.size();

                for(int k = 0; k < j; k++) {
                    if(entityliving.worldObj.loadedEntityList.get(k) instanceof EntityMobs) {
                        i++;
                    }
                }

                displayMessage((new StringBuilder()).append("hostiles: ").append(i).toString());
            } else if(Keyboard.isKeyDown(PetFreezeKey.get())) {
                if(!keyPressed) {
                    keyPressed = true;
                    freezePets = !freezePets;
                }
            } else {
                keyPressed = false;
            }
        }
    }

    public static void hostileTick(EntityMobs entitymobs) {
        if(entitymobs.AIDelay < 0) {
            entitymobs.AIDelay = 10 + entitymobs.worldObj.rand.nextInt(10);
            float f = -1F;
            float f3 = 999999F;
            float f4 = 999999F;
            boolean flag1 = false;
            boolean flag3 = false;
            EntityLiving entityliving = null;
            EntityLiving entityliving1 = null;
            EntityPlayer entityplayer = theplayer;

            if(fireImmuneHostiles.get()) {
                entitymobs.fire = 0;
                entitymobs.isImmuneToFire = true;
            }

            try {
                if(!(entitymobs instanceof EntityCreeper)) {
                    List list = null;
                    list = entitymobs.worldObj.getEntitiesWithinAABBExcludingEntity(entitymobs, entitymobs.boundingBox.expand(2D, 2D, 2D));
                    boolean flag2;

                    if(list.size() > 6) {
                        iCount++;
                        flag2 = true;
                        flag3 = false;
                    } else {
                        flag2 = false;
                    }

                    for(int i = 0; i < list.size(); i++) {
                        EntityLiving entityliving2 = (EntityLiving)list.get(i);

                        if(!(entityliving2 instanceof EntityLiving)) {
                            continue;
                        }

                        EntityLiving entityliving3 = (EntityLiving)entityliving2;

                        if(!flag3 && entitymobs.team == entityliving3.team && (entityliving3 instanceof EntityCreature)) {
                            entitymobs.playerToAttack = ((EntityCreature)entityliving3).playerToAttack;
                            flag3 = true;
                        }

                        if(fireSpreadsOnEnts.get() && entityliving3.fire > 0 && entitymobs.fire < 1) {
                            entitymobs.fire = entityliving3.fire;
                        }
                    }

                    list = null;

                    if(entitymobs.canSwitchTarget && !flag2) {
                        list = entitymobs.worldObj.getEntitiesWithinAABBExcludingEntity(entitymobs, entitymobs.boundingBox.expand(hostileTickScanRangeX, hostileTickScanRangeY, hostileTickScanRangeZ));
                    } else if(entityliving1 == null) {
                        if(entitymobs.playerToAttack != null) {
                            entitymobs.state = 4;
                        } else {
                            entitymobs.state = 1;
                        }
                    }

                    if(list != null) {
                        for(int j = 0; j < list.size(); j++) {
                            Entity entity = (Entity)list.get(j);

                            if(!(entity instanceof EntityLiving)) {
                                continue;
                            }

                            EntityLiving entityliving4 = (EntityLiving)entity;
                            entityliving4 = (EntityLiving)list.get(j);

                            if((!(entityliving4 instanceof EntityAnimals) || !hostilesAttackAnimals) && !(entityliving4 instanceof EntityPlayer) && entityliving4.team != playerTeamInit) {
                                continue;
                            }

                            float f1 = entitymobs.getDistanceToEntity(entityliving4);
                            boolean flag = entitymobs.canEntityBeSeen(entityliving4);

                            if(flag && f1 < f4) {
                                f4 = f1;
                                entityliving = entityliving4;
                            }

                            if(f1 < f3 && (flag || !hostileLOSCheck)) {
                                f3 = f1;
                                entityliving1 = entityliving4;
                            }
                        }

                        if(entityliving1 == null) {
                            if(defaultTargetPlayer) {
                                entitymobs.playerToAttack = theplayer;
                                entitymobs.state = 4;
                            } else {
                                entitymobs.playerToAttack = null;
                                entitymobs.state = 1;
                            }
                        } else if(entityliving != null) {
                            entitymobs.playerToAttack = entityliving;
                            entitymobs.state = 4;
                        } else {
                            entitymobs.playerToAttack = entityliving1;
                            entitymobs.state = 4;

                            if(entitymobs.playerToAttack == null) {
                                entitymobs.state = 1;
                            }
                        }
                    }
                } else {
                    if(defaultTargetPlayer) {
                        entitymobs.playerToAttack = theplayer;
                        entitymobs.state = 4;
                    } else if(entitymobs.playerToAttack == null) {
                        entitymobs.state = 1;
                    } else {
                        entitymobs.state = 4;
                    }

                    if(creepersExplodeIfStuck && notMoving(entitymobs, 0.05F) && entitymobs.playerToAttack == theplayer) {
                        entitymobs.AIDelay = 0;
                        entitymobs.attackEntity(entitymobs, 1.0F);
                    }
                }
            } catch(Exception exception) { }
        }

        if(defaultTargetPlayer && entitymobs.canSwitchTarget && entitymobs.playerToAttack == null) {
            entitymobs.playerToAttack = theplayer;
        }

        entitymobs.AIDelay--;

        if(notMoving(entitymobs, 0.05F)) {
            entitymobs.noMoveTicks++;
        } else {
            entitymobs.noMoveTicks = 0;
            entitymobs.mining = false;

            if(entitymobs instanceof EntityZombieMiner) {
                ((EntityZombieMiner)entitymobs).swingArm = false;
            }
        }

        if(hostilesBreakWalls && !entitymobs.handleWaterMovement() && (entitymobs instanceof EntityZombieMiner)) {
            entitymobs.forcejump = false;
            entitymobs.mineDelay--;

            if(entitymobs.mineDelay < 1 && entitymobs.noMoveTicks > 10) {
                entitymobs.mineDelay = 3;
                entitymobs.mining = true;
                tryDig(entitymobs, (EntityLiving)entitymobs.playerToAttack);
            }

            entitymobs.info = entitymobs.noMoveTicks;
        }

        float f2 = entitymobs.getDistanceToEntity(theplayer);
        entitymobs.info = f2;

        if((double)f2 > 1024D) {
            entitymobs.setEntityDead();
        }

        if(entitymobs.noMoveTicks > 60 && entitymobs.rand.nextInt(800) == 0) {
            if((double)f2 >= 64D || entitymobs.posY < 60D && theplayer.posY - entitymobs.posY > 15D) {
                entitymobs.setEntityDead();
                //displayMessage((new StringBuilder()).append("removing ent").append("").toString());
            } else {
                entitymobs.noMoveTicks = 0;
            }
        }
    }

    public static void mineComplete(EntityLiving entityliving) {
        entityliving.mining = false;
        entityliving.noMoveTicks = 0;
        entityliving.curBlockDmg = 0.0F;

        if(entityliving instanceof EntityZombieMiner) {
            ((EntityZombieMiner)entityliving).swingArm = false;
            entityliving.forcejump = true;
        }
    }

    public static boolean notMoving(EntityLiving entityliving, float f) {
        double d = entityliving.prevPosX - entityliving.posX;
        double d1 = entityliving.prevPosZ - entityliving.posZ;
        float f1 = MathHelper.sqrt_double(d * d + d1 * d1);
        return f1 < f;
    }

    public static void tryDig(EntityLiving entityliving, EntityLiving entityliving1) {
        if(entityliving1 == null) {
            return;
        }

        float f = 2.0F;
        float f1 = entityliving.prevRotationPitch + (entityliving.rotationPitch - entityliving.prevRotationPitch) * f;
        float f2 = entityliving.prevRotationPitch + (entityliving.rotationPitch - entityliving.prevRotationPitch) * f;
        f1 = 0.0F;
        float f3 = entityliving.prevRotationYaw + (entityliving.rotationYaw - entityliving.prevRotationYaw) * f;
        int i = (int)Math.floor((double)(f3 / 90F) + 0.5D);
        f3 = (float)i * 90F;
        double d = entityliving.prevPosX + (entityliving.posX - entityliving.prevPosX) * (double)f;
        double d1 = (entityliving.prevPosY + (entityliving.posY - entityliving.prevPosY) * (double)f + 1.6200000000000001D) - (double)entityliving.yOffset;
        double d2 = entityliving.prevPosZ + (entityliving.posZ - entityliving.prevPosZ) * (double)f;
        Vec3D vec3d = Vec3D.createVector(d, d1, d2);
        float f4 = MathHelper.cos(-f3 * 0.01745329F - 3.141593F);
        float f5 = MathHelper.sin(-f3 * 0.01745329F - 3.141593F);
        float f6 = -MathHelper.cos(-f1 * 0.01745329F - 0.7853982F);
        float f7 = MathHelper.sin(-f1 * 0.01745329F - 0.7853982F);
        float f8 = f5 * f6;
        float f9 = f7;
        float f10 = f4 * f6;
        entityliving.info = f3;
        double d3 = 1.0D;
        double d4 = 1.8D;
        double d5 = 0.050000000000000003D;
        Vec3D vec3d1 = vec3d.addVector((double)f8 * d3, (double)f9 * d3, (double)f10 * d3);
        MovingObjectPosition movingobjectposition = entityliving.worldObj.rayTraceBlocks_do(vec3d, vec3d1, true);

        if(movingobjectposition == null) {
            return;
        }

        int j = MathHelper.floor_float((float)(entityliving.posX - entityliving1.posX));
        int k = (int)(entityliving.posY - entityliving1.posY);
        int l = MathHelper.floor_float((float)(entityliving.posZ - entityliving1.posZ));
        boolean flag = false;

        if(j + l > 0) {
            if((float)(k / (j + l)) > 1.0F) {
                flag = true;
            }
        } else if(k > 2) {
            flag = true;
        }

        if(movingobjectposition.typeOfHit == EnumMovingObjectType.TILE || flag) {
            int i2 = f2 >= -20F ? 0 : 1;
            int i1;
            int j1;
            int k1;

            if(flag) {
                i1 = (int)entityliving.posX;
                j1 = (int)entityliving.posZ - 1;
                k1 = (int)entityliving.posZ;
            } else {
                i1 = movingobjectposition.blockX;
                j1 = movingobjectposition.blockY + i2;
                k1 = movingobjectposition.blockZ;
            }

            int l1 = entityliving.worldObj.getBlockId(i1, j1, k1);

            if(l1 == 0 && (i2 == 1 || flag)) {
                j1--;
                l1 = entityliving.worldObj.getBlockId(i1, j1, k1);

                if(l1 == 0 && i2 == 1) {
                    j1--;
                    l1 = entityliving.worldObj.getBlockId(i1, j1, k1);
                }
            }

            if(i1 != entityliving.curBlockX || j1 != entityliving.curBlockZ) {
                entityliving.curBlockDmg = 0.0F;
                entityliving.curBlockX = i1;
                entityliving.curBlockZ = j1;
            }

            Block block = Block.blocksList[l1];
            float f11 = MiningZombieDigPower.get() * (float)(entityliving.nearbyMinerCount + 1);

            if(block != null) {
                if(entityliving instanceof EntityZombieMiner) {
                    ((EntityZombieMiner)entityliving).swingArm = true;
                }

                double d6 = (double)f8 * d5;
                double d7 = (double)f9 * d5;
                double d8 = (double)f10 * d5;

                for(int j2 = 0; j2 <= (int)entityliving.curBlockDmg; j2++) {
                    entityliving.worldObj.spawnParticle("explode", d + ((double)f8 * d4 + (double)(entityliving.worldObj.rand.nextFloat() * (entityliving.curBlockDmg / 10F))), d1 + (double)f9 * d4 + 0.0D + (double)((entityliving.worldObj.rand.nextFloat() * entityliving.curBlockDmg) / 10F), d2 + ((double)f10 * d4 + (double)((entityliving.worldObj.rand.nextFloat() * entityliving.curBlockDmg) / 10F)), 0.0D, 0.0D, 0.0D);
                }

                mc.effectRenderer.addBlockHitEffects((int)i1, (int)j1, (int)k1, 0);
                
                entityliving.worldObj.playSoundAtEntity(entityliving, "step.stone", 1.0F, 1.0F / (entityliving.worldObj.rand.nextFloat() * 0.4F + 0.8F));
                entityliving.curBlockDmg += f11 / (float)block.blockHardness;

                if(entityliving.getDistanceToEntity(theplayer) >= 17F);

                if(entityliving.curBlockDmg > 10F) {
                    entityliving.curBlockDmg = 0.0F;
                    mc.effectRenderer.addBlockDestroyEffects((int)i1, j1, k1);
                    entityliving.worldObj.spawnParticle("flame", d + (double)f8 * d4, d1 + (double)f9 * d4, d2 + (double)f10 * d4, d6 / 2D, d7 / 2D, d8 / 2D);
                    entityliving.worldObj.setBlockWithNotify(i1, j1, k1, 0);
                    mineComplete(entityliving);
                    entityliving.nearbyMinerCount = 0;
                    Object obj = null;
                    List list = entityliving.worldObj.getEntitiesWithinAABBExcludingEntity(entityliving, entityliving.boundingBox.expand(2D, 2D, 2D));

                    if(list != null) {
                        for(int k2 = 0; k2 < list.size(); k2++) {
                            Entity entity = (Entity)list.get(k2);

                            if(entity instanceof EntityLiving) {
                                entityliving.nearbyMinerCount++;
                                mineComplete((EntityLiving)entity);
                            }
                        }
                    }
                }

                if(entityliving.worldObj.getBlockMaterial(i1, j1, k1) != Material.ground) {
                    if(entityliving.worldObj.getBlockMaterial(i1, j1, k1) != Material.rock);
                }
            }
        }
    }

    public static PathEntity PFTry(EntityCreature entitycreature, float f) {
        if(entitycreature.PFDelay < 0 && !noPF) {
            if(entitycreature.PFDelay > -15) {
                entitycreature.PFDelay = 40;
            }

            entitycreature.PFDelay = 20;
            return entitycreature.worldObj.getPathToEntity(entitycreature, entitycreature.playerToAttack, f);
        } else {
            return null;
        }
    }

    public static void animalTick(EntityCreature entitycreature) {
        float f = -1F;
        float f1 = 999999F;
        Entity entity = entitycreature.playerToAttack;

        if(entitycreature.getDistanceToEntity(theplayer) > petFollowRange && forcePetStayNear && entitycreature.orders == 1) {
            entitycreature.playerToAttack = theplayer;
            entitycreature.state = 3;
        } else {
            entitycreature.playerToAttack = entity;

            if(entitycreature.playerToAttack != null) {
                entitycreature.state = 4;
            } else {
                entitycreature.state = 1;
            }
        }

        if((entitycreature.playerToAttack instanceof EntityPlayer) && entitycreature.getDistanceToEntity(entitycreature.playerToAttack) < petFollowRange && entitycreature.orders == 1) {
            entitycreature.playerToAttack = null;
            entitycreature.state = 1;
        }
    }

    public static Field getTargetField(Entity entity) {
        try {
            if(entity instanceof EntityGhast) {
                return (EntityGhast.class).getField("d");
            }

            if(entity instanceof EntityCreature) {
                return (EntityCreature.class).getField("d");
            } else {
                return null;
            }
        } catch(NoSuchFieldException nosuchfieldexception) {
            return null;
        }
    }

    public static boolean isThreat(EntityLiving entityliving, EntityLiving entityliving1) {
        if(!(entityliving1 instanceof EntityCreature) || !(entityliving instanceof EntityCreature)) {
            return false;
        }

        if(((EntityCreature)entityliving1).playerToAttack == null || !(((EntityCreature)entityliving1).playerToAttack instanceof EntityLiving)) {
            return false;
        }

        if(((EntityLiving)((EntityCreature)entityliving1).playerToAttack).team == 1) {
            return true;
        }

        return ((EntityCreature)entityliving1).playerToAttack == theplayer || ((EntityCreature)entityliving1).playerToAttack == entityliving.guardEnt || ((EntityCreature)entityliving1).playerToAttack == entityliving;
    }

    public static void petTick(EntityLiving entityliving) {
        Object obj = null;

        if(entityliving.AIDelay < 0) {
            entityliving.AIDelay = 5;
            float f = -1F;
            float f3 = 999999F;
            EntityLiving entityliving1 = null;
            EntityPlayer entityplayer = theplayer;
            entityliving.mining = false;
            entityliving.forcejump = false;

            if(killAllPets) {
                entityliving.setEntityDead();
            }

            if(worldRef != null && petAutoHeal.get() && worldRef.worldInfo.getWorldTime() % 5L == 0L) {
                heal(entityliving, 1);
            }

            entityliving.fire = 0;

            if((entityliving instanceof EntityMobs) || (entityliving instanceof EntityGhast) || isNonDefaultAnimal(entityliving)) {
                List list = entityliving.worldObj.getEntitiesWithinAABBExcludingEntity(entityliving, entityliving.boundingBox.expand(petTickScanRangeX, petTickScanRangeY, petTickScanRangeZ));

                if(list != null) {
                    for(int i = 0; i < list.size(); i++) {
                        Entity entity = (Entity)list.get(i);

                        if(!(entity instanceof EntityLiving)) {
                            continue;
                        }

                        EntityLiving entityliving2 = (EntityLiving)entity;

                        if(((entityliving2 instanceof EntityMobs) && !isNobleHuman(entityliving2) || (entityliving2 instanceof EntitySlime) || (entityliving2 instanceof EntityGhast) || entityliving2 == entityliving.attackingEnt || isThreat(entityliving, entityliving2)) && entityliving2 != entityliving && entityliving2.team != playerTeamInit) {
                            float f1 = entityliving.getDistanceToEntity(entityliving2);

                            if(f1 < f3 && (entityliving.canEntityBeSeen(entityliving2) || !petLOSCheck)) {
                                f3 = f1;
                                entityliving1 = entityliving2;
                            }

                            continue;
                        }

                        if(entityliving.guardEnt == null || entityliving2.uID != ((EntityLiving)entityliving.guardEnt).uID || entityliving.orders != 1) {
                            continue;
                        }

                        float f2 = entityliving.getDistanceToEntity(entityliving2);

                        if(f2 < f3 && f2 > petFollowRange) {
                            f3 = f2;
                            entityliving1 = entityliving2;
                        }
                    }
                }
            }

            Object obj1 = entityliving1;

            if(entityliving.orders == 1) {
                if(entityliving.getDistanceToEntity(entityliving.guardEnt) > petFollowRange) {
                    if(entityliving1 == null || entityliving1 == entityliving.guardEnt || forcePetStayNear) {
                        obj1 = entityliving.guardEnt;
                        entityliving.state = 3;
                    }
                } else if(entityliving1 == null) {
                    entityliving.state = 1;
                } else {
                    entityliving.state = 4;
                }
            } else if(entityliving.orders == 4) {
                if(entityliving.getDistance(entityliving.guardX, entityliving.guardY, entityliving.guardZ) > (double)petFollowRange) {
                    if(entityliving1 == null || entityliving1 == entityliving.guardEnt || forcePetStayNear) {
                        if(entityliving1 == null) {
                            obj1 = null;
                        }

                        entityliving.state = 2;
                    }
                } else if(entityliving.getDistance(entityliving.guardX, entityliving.guardY, entityliving.guardZ) <= (double)(petFollowRange / 2.0F)) {
                    if(entityliving1 == null) {
                        if(entityliving.state != 1) {
                            setEntVel(entityliving, 0.0F, 0.0F, 0.0F);
                        }

                        entityliving.state = 1;
                        obj1 = null;
                    } else {
                        entityliving.state = 4;
                    }
                }
            } else if(obj1 != null && !(obj1 instanceof EntityPlayer) && entityliving.team != ((EntityLiving)obj1).team) {
                entityliving.state = 4;
            } else {
                entityliving.state = 1;
            }

            if(entityliving.orders != 4 && (obj1 instanceof EntityPlayer) && (entityliving.getDistanceToEntity(((Entity) (obj1))) < petFollowRange || entityliving.orders != 1)) {
                setEntVel(entityliving, 0.0F, 0.0F, 0.0F);
                obj1 = null;
                entityliving.state = 1;
            }

            if(obj1 != null && (obj1 instanceof EntityPlayer) && entityliving.orders != 1 && entityliving.orders != 4) {
                obj1 = null;
                entityliving.state = 1;
            }

            entityliving.info = entityliving.state;

            try {
                if(entityliving instanceof EntityCreature) {
                    if(!(((EntityCreature)entityliving).playerToAttack instanceof EntityItem)) {
                        getTargetField(entityliving).set(entityliving, obj1);
                    }
                } else if(getTargetField(entityliving) != null) {
                    getTargetField(entityliving).set(entityliving, obj1);
                }
            } catch(Exception exception) { }
        }
        
        if (entityliving instanceof EntitySheep) {
        	if (entityliving.mineDelay == 0) {
        		((EntitySheep)entityliving).setSheared(false);
        		((EntitySheep)entityliving).health = ((EntitySheep)entityliving).maxhealth;
        		entityliving.mineDelay = -1;
        	} else if (entityliving.mineDelay == -1) {
        		if (((EntitySheep)entityliving).getSheared()) {
        			entityliving.mineDelay = 24000;
        		}
        	} else {
        		entityliving.mineDelay--;
        	}
        }

        entityliving.AIDelay--;
    }

    public static void callForHelp(Entity entity, Entity entity1) {
        if(!(entity instanceof EntityLiving) || !(entity1 instanceof EntityLiving)) {
            return;
        }

        if((entity1 instanceof EntityPlayer) || ((EntityLiving)entity).team == ((EntityLiving)entity1).team) {
            return;
        }

        Object obj = null;
        List list = entity.worldObj.getEntitiesWithinAABBExcludingEntity(entity, entity.boundingBox.expand(20D, 20D, 20D));

        if(list != null) {
            for(int i = 0; i < list.size(); i++) {
                Entity entity2 = (Entity)list.get(i);

                if((entity2 instanceof EntityLiving) && ((EntityLiving)entity2).team == playerTeamInit) {
                    ((EntityLiving)entity2).attackingEnt = entity1;
                }
            }
        }
    }

    public static void setEntVel(EntityLiving entityliving, float f, float f1, float f2) {
        entityliving.moveStrafing = f;
        entityliving.moveForward = f1;
        entityliving.randomYawVelocity = f2;
    }

    public static int getMaxEntCount(Class class1) {
        return class1.getName() != (EntityAnimals.class).getName() ? 200 : 40;
    }

    public static boolean isOrigMob(EntityLiving entityliving) {
        try {
            return (entityliving instanceof EntityCreeper) || (entityliving instanceof EntityGhast) || entityliving instanceof EntityPigZombie || (entityliving instanceof EntitySkeleton) || (entityliving instanceof EntitySlime) || (entityliving instanceof EntitySpider) || (entityliving instanceof EntityZombie) || (entityliving instanceof EntityZombieMiner) || (entityliving instanceof EntityZombieNazi) || (entityliving instanceof EntityZombieKnight);
        } catch(Exception exception) {
            return false;
        }
    }

    public static boolean isGuardian(EntityLiving entityliving) {
        try {
            return Class.forName("SdkEntityGuardians").isInstance(entityliving);
        } catch(Exception exception) {
            return false;
        }
    }

    public static boolean isNobleHuman(EntityLiving entityliving) {
        try {
            if(Class.forName("HumanBehaviourAI").isInstance(entityliving)) {
                return true;
            }
        } catch(Exception exception) {
            return false;
        }

        return false;
    }

    public static boolean isPet(EntityLiving entityliving) {
        try {
            Field field = (EntityLiving.class).getDeclaredField("team");
            return field.getInt(entityliving) == 1;
        } catch(Exception exception) {
            return false;
        }
    }

    public static boolean isNonDefaultAnimal(EntityLiving entityliving) {
        try {
            if(entityliving instanceof EntityAnimals) {
                return !(entityliving instanceof EntityChicken) && !(entityliving instanceof EntityCow) && !(entityliving instanceof EntityPig) && !(entityliving instanceof EntitySheep);
            } else {
                return false;
            }
        } catch(Exception exception) {
            return false;
        }
    }

    public static Item domrod;
    public static Item domrod_enhanced;
    public static int spriteIndex;
    public static int usedSpriteIndex;
    public static String modName = "AIManager";
    public static World worldRef;
    public static Minecraft mc;
    public static Class cls_itemfood;
    public static Class cls_entliving;
    public static int timeout;
    public static String msg;
    public static int color;
    public static int defaultColor = 0xffffff;
    public static int selAIOrder = 1;
    public static int orderState = 0;
    public static Entity orderedEnt = null;
    public static double hostileTickScanRangeX;
    public static double hostileTickScanRangeY;
    public static double hostileTickScanRangeZ;
    public static double petTickScanRangeX;
    public static double petTickScanRangeY;
    public static double petTickScanRangeZ;
    public static float mobGameScanRangeRadius;
    public static float mobSpawnerStartRange;
    public static double mobSpawnerSpawnAreaX;
    public static double mobSpawnerSpawnAreaY;
    public static double mobSpawnerSpawnAreaZ;
    public static int mobSpawnerMaxEntsInArea;
    public static float mobSpawnerSpawnRateFixed;
    public static float mobSpawnerSpawnRateRandom;
    public static float petFollowRange;
    public static int hostileTeamInit = 2;
    public static int animalTeamInit = 0;
    public static int playerTeamInit = 1;
    public static int guardianTeamInit = 4;
    public static boolean hostileLOSCheck;
    public static boolean petLOSCheck;
    public static boolean hostilesAttackAnimals;
    public static boolean forcePetStayNear;
    public static int petHealthInit;
    public static float petHealFactor;
    public static int petSkeleCooldown;
    public static float petSkeleRange;
    public static float petSkeleAccuracy;
    public static int enhPetCooldown;
    public static float enhPetDamage;
    public static float enhPetSpeedMultiplier;
    public static boolean defaultTargetPlayer;
    public static boolean hostilesBreakWalls;
    public static boolean creepersExplodeIfStuck;
    public static boolean spidersClimbWalls;
    public static boolean keyPressed;
    public static long spriteCount;
    public static boolean dbg_prcAI;
    public static boolean dbg_prcPF;
    public static boolean timeControl;
    public static float safetyDistanceCutoff = 480F;
    public static boolean noPF;
    public static boolean allHealthBars;
    public static boolean LOSHealthBars;
    public static boolean firstTick = true;
    public static EntityPlayer theplayer;
    public static long TickCount = 0L;
    public static int maxHostiles;
    public static int maxAnimals;
    public static int maxWaterCreatures;
    public static float miningPower;
    public static boolean killAllPets = false;
    public static int iCount = 0;
    public static EntityLiving entT;
    
    public static ModSettings petSettings;
    public static ModSettings NMSettings;
    
    public static SettingKey nextOrderKey;
    public static SettingKey prevOrderKey;
    public static SettingKey PetFreezeKey;
    public static boolean freezePets;
    public static SettingBoolean petLOSCheckB;
    public static WidgetBoolean petLOSCheckW;
    public static SettingKey petFollowNearKey;
    public static SettingKey petFollowFarKey;
    public static SettingInt petFollowDistNear;
    public static SettingInt petFollowDistFar;
    public static SettingKey forcePetStayNearKey;
    public static WidgetKeybinding forcePetStayNearKeyW;
    public static WidgetKeybinding nextOrderKeyW;
    public static WidgetKeybinding prevOrderKeyW;
    public static WidgetKeybinding PetFreezeKeyW;
    public static WidgetKeybinding petFollowNearKeyW;
    public static WidgetKeybinding petFollowFarKeyW;
    public static WidgetInt petFollowDistNearW;
    public static WidgetInt petFollowDistFarW;
    public static SettingInt petTickScanRangeXI;
    public static SettingInt petTickScanRangeYI;
    public static SettingInt petTickScanRangeZI;
    public static WidgetInt petTickScanRangeXW;
    public static WidgetInt petTickScanRangeYW;
    public static WidgetInt petTickScanRangeZW;
    public static SettingInt petHealthInitI;
    public static WidgetInt petHealthInitW;
    public static SettingFloat petHealFactorF;
    public static WidgetFloat petHealFactorW;
    public static SettingInt petSkeleCooldownI;
    public static WidgetInt petSkeleCooldownW;
    public static SettingInt petSkeleRangeI;
    public static WidgetInt petSkeleRangeW;
    public static SettingFloat petSkeleAccuracyF;
    public static WidgetFloat petSkeleAccuracyW;
    public static SettingInt enhPetCooldownI;
    public static WidgetInt enhPetCooldownW;
    public static SettingFloat enhPetDamageF;
    public static WidgetFloat enhPetDamageW;
    public static SettingFloat enhPetSpeedMultiplierF;
    public static WidgetFloat enhPetSpeedMultiplierW;
    public static SettingBoolean timeControlB;
    public static WidgetBoolean timeControlW;
    public static SettingBoolean healthBarsLOS;
    public static WidgetBoolean healthBarsLOSW;
    public static SettingBoolean killAllPetsB;
    public static WidgetBoolean killAllPetsW;
    
    public static ModSettingScreen petScreen;
    public static ModSettingScreen NMScreen;
    
    public static SettingBoolean EnableNMModeB;
    public static WidgetBoolean EnableNMModeW;
    public static SettingBoolean defaultTargetPlayerB;
    public static WidgetBoolean defaultTargetPlayerW;
    public static SettingBoolean NaziB;
    public static WidgetBoolean NaziW;
    public static SettingBoolean KnightB;
    public static WidgetBoolean KnightW;
    public static SettingBoolean hostilesBreakWallsB;
    public static WidgetBoolean hostilesBreakWallsW;
    public static SettingFloat MiningZombieDigPower;
    public static WidgetFloat MiningZombieDigPowerW;
    public static SettingBoolean creepersExplodeIfStuckB;
    public static WidgetBoolean creepersExplodeIfStuckW;
    public static SettingBoolean hostilesAttackAnimalsB;
    public static WidgetBoolean hostilesAttackAnimalsW;
    public static SettingBoolean hostileLOSCheckB;
    public static WidgetBoolean hostileLOSCheckW;
    public static SettingInt hostileTickScanRangeXI;
    public static SettingInt hostileTickScanRangeYI;
    public static SettingInt hostileTickScanRangeZI;
    public static WidgetInt hostileTickScanRangeXW;
    public static WidgetInt hostileTickScanRangeYW;
    public static WidgetInt hostileTickScanRangeZW;
    public static SettingInt mobSpawnerStartRangeI;
    public static WidgetInt mobSpawnerStartRangeW;
    public static SettingInt mobSpawnerSpawnAreaXI;
    public static WidgetInt mobSpawnerSpawnAreaXW;
    public static SettingInt mobSpawnerSpawnAreaYI;
    public static WidgetInt mobSpawnerSpawnAreaYW;
    public static SettingInt mobSpawnerSpawnAreaZI;
    public static WidgetInt mobSpawnerSpawnAreaZW;
    public static SettingInt mobSpawnerMaxEntsInAreaI;
    public static WidgetInt mobSpawnerMaxEntsInAreaW;
    public static SettingInt mobSpawnerSpawnRateFixedI;
    public static WidgetInt mobSpawnerSpawnRateFixedW;
    public static SettingInt mobSpawnerSpawnRateRandomI;
    public static WidgetInt mobSpawnerSpawnRateRandomW;
    public static SettingBoolean VerticalCollision;
    public static WidgetBoolean VerticalCollisionW;
    public static SettingBoolean DamageCooldown;
    public static WidgetBoolean DamageCooldownW;
    public static SettingBoolean NothingPushesPlayer;
    public static WidgetBoolean NothingPushesPlayerW;
    public static SettingBoolean fireImmuneHostiles;
    public static WidgetBoolean fireImmuneHostilesW;
    public static SettingBoolean fireSpreadsOnEnts;
    public static WidgetBoolean fireSpreadsOnEntsW;
    public static SettingBoolean unlimitedEntityRenderRange;
    public static WidgetBoolean unlimitedEntityRenderRangeW;
    public static SettingInt maxHostilesI;
    public static SettingInt maxAnimalsI;
    public static SettingInt maxWaterCreaturesI;
    public static WidgetInt maxHostilesW;
    public static WidgetInt maxAnimalsW;
    public static WidgetInt maxWaterCreaturesW;
    
    public static SettingText blah;
    public static Widget blahW;
    public static SettingText blah2;
    public static Widget blah2W;
    
    public static SettingBoolean forceRevive;
    public static WidgetBoolean forceReviveW;
    public static SettingBoolean petAutoHeal;
    public static WidgetBoolean petAutoHealW;
    
    public static SettingBoolean hostileHumans;
    public static WidgetBoolean hostileHumansW;
    
    
    public static boolean tornado = false;
    public static int try1 = 3;
    public static int try2 = 12;
    public static Field minecraftTicksRan = null;
    public static int lastTickRun = 0;

    static {
        cls_itemfood = ItemFood.class;
        cls_entliving = EntityLiving.class;
    }
}
